package com.me.springkafka;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * @author zhengchubin
 * @create 2017-11-08 下午5:26
 **/
@Component
public class MsgConsumer {

    @KafkaListener(topics = "myTopic")
    public void processMsg(String content){
        System.out.println("msg:"+content);
    }

    @KafkaListener(topics = "topicKey")
    public void processKey(ConsumerRecord<?, ?> record){
        System.out.println("key:"+record.key());
        System.out.println("value:"+record.value().toString());
    }


}
